package org.cshoo.sys.command
{
	import com.adobe.cairngorm.commands.ICommand;
	import com.adobe.cairngorm.control.CairngormEvent;
	import mx.controls.Alert;
	import mx.rpc.events.ResultEvent;
	import mx.rpc.IResponder;
	
	import org.cshoo.sys.business.RoleDelegate;
	import org.cshoo.sys.event.UpdateRoleEvent;
	import org.cshoo.sys.model.vo.Role;
	
	public class UpdateRoleCommand implements ICommand, IResponder
	{
		
		public function execute(event:CairngormEvent):void
		{
			var role:Role = (event as UpdateRoleEvent).role;
			var roleDelegate:RoleDelegate = new RoleDelegate(this);
			roleDelegate.updateRole(role);
		}
		
		public function result(event:Object):void
		{
			if((event as ResultEvent).result as Boolean)
			{
			}
			else
				Alert.show("保存失败");
		}
		
		public function fault(info:Object):void
		{
			Alert.show("保存失败");
		}
	}
}